675  ***get all the inventors;
676  *track their movements;
677  *assignee names (employer);
678  proc sql;
678!            *21197038;
679      create table patinvloc as select distinct
680      a.*, b.*
681      from uspto_patinv1 as a left join uspto_loc1 as b
682      on a.location_id = b.location_id ;
WARNING: Variable location_id already exists on file WORK.PATINVLOC.
NOTE: Table WORK.PATINVLOC created, with 21197038 rows and 15 columns.

683      quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           58.88 seconds
      cpu time            49.40 seconds


684  run; * 21197038;
685  data patinvloc1;
686  set patinvloc;
687  nr_pt = patent_id + 0;
688  run;

NOTE: Character values have been converted to numeric values at the places given by:
      (Line):(Column).
      687:9
NOTE: Invalid numeric data, patent_id='D242583' , at line 687 column 9.
patent_id=D242583 inventor_sequence=0 inventor_id=fl:le_ln:knight-6
disambig_inventor_name_first=Lewis Charles disambig_inventor_name_last=Knight gender_code=M
location_id=  disambig_city=  disambig_state=  disambig_country=  latitude=. longitude=.
county=  state_fips=  county_fips=  nr_pt=. _ERROR_=1 _N_=19717496
NOTE: Invalid numeric data, patent_id='D242584' , at line 687 column 9.
patent_id=D242584 inventor_sequence=0 inventor_id=fl:ja_ln:kaufman-1
disambig_inventor_name_first=Jack W. disambig_inventor_name_last=Kaufman gender_code=M
location_id=0d054244-16c8-11ed-9b5f-1234bde3cd05 disambig_city=Merrick disambig_state=NY
disambig_country=US latitude=40.6628796 longitude=-73.551516 county=Nassau state_fips=36
county_fips=059 nr_pt=. _ERROR_=1 _N_=19717497
NOTE: Invalid numeric data, patent_id='D242585' , at line 687 column 9.
patent_id=D242585 inventor_sequence=0 inventor_id=fl:ja_ln:kaufman-1
disambig_inventor_name_first=Jack W. disambig_inventor_name_last=Kaufman gender_code=M
location_id=0d054244-16c8-11ed-9b5f-1234bde3cd05 disambig_city=Merrick disambig_state=NY
disambig_country=US latitude=40.6628796 longitude=-73.551516 county=Nassau state_fips=36
county_fips=059 nr_pt=. _ERROR_=1 _N_=19717498
NOTE: Invalid numeric data, patent_id='D242586' , at line 687 column 9.
patent_id=D242586 inventor_sequence=0 inventor_id=fl:ja_ln:kaufman-1
disambig_inventor_name_first=Jack W. disambig_inventor_name_last=Kaufman gender_code=M
location_id=0d054244-16c8-11ed-9b5f-1234bde3cd05 disambig_city=Merrick disambig_state=NY
disambig_country=US latitude=40.6628796 longitude=-73.551516 county=Nassau state_fips=36
county_fips=059 nr_pt=. _ERROR_=1 _N_=19717499
NOTE: Invalid numeric data, patent_id='D242587' , at line 687 column 9.
patent_id=D242587 inventor_sequence=0 inventor_id=fl:wi_ln:sklaroff-1
disambig_inventor_name_first=William disambig_inventor_name_last=Sklaroff gender_code=M
location_id=0e418846-16c8-11ed-9b5f-1234bde3cd05 disambig_city=Levittown disambig_state=PA
disambig_country=US latitude=40.1541257 longitude=-74.8408768 county=Bucks state_fips=42
county_fips=017 nr_pt=. _ERROR_=1 _N_=19717500
NOTE: Invalid numeric data, patent_id='D242588' , at line 687 column 9.
patent_id=D242588 inventor_sequence=0 inventor_id=m6jgoibgwder3dj0bs4otedv4
disambig_inventor_name_first=Edouard disambig_inventor_name_last=Hewak gender_code=M
location_id=16b3c6f8-16c8-11ed-9b5f-1234bde3cd05 disambig_city=Chartres disambig_state=
disambig_country=FR latitude=48.4438601 longitude=1.4881434 county=  state_fips=
county_fips=  nr_pt=. _ERROR_=1 _N_=19717501
NOTE: Invalid numeric data, patent_id='D242589' , at line 687 column 9.
patent_id=D242589 inventor_sequence=0 inventor_id=fl:jo_ln:leto-2
disambig_inventor_name_first=Joseph disambig_inventor_name_last=Leto gender_code=M
location_id=e33aaf88-16c7-11ed-9b5f-1234bde3cd05 disambig_city=Cambridge disambig_state=WI
disambig_country=US latitude=43.0036122 longitude=-89.0164995 county=Jefferson state_fips=55
county_fips=055 nr_pt=. _ERROR_=1 _N_=19717502
NOTE: Invalid numeric data, patent_id='D242590' , at line 687 column 9.
patent_id=D242590 inventor_sequence=0 inventor_id=fl:wi_ln:sklaroff-1
disambig_inventor_name_first=William disambig_inventor_name_last=Sklaroff gender_code=M
location_id=0e418846-16c8-11ed-9b5f-1234bde3cd05 disambig_city=Levittown disambig_state=PA
disambig_country=US latitude=40.1541257 longitude=-74.8408768 county=Bucks state_fips=42
county_fips=017 nr_pt=. _ERROR_=1 _N_=19717503
NOTE: Invalid numeric data, patent_id='D242591' , at line 687 column 9.
patent_id=D242591 inventor_sequence=0 inventor_id=fl:do_ln:hurd-3
disambig_inventor_name_first=Donald Leroy disambig_inventor_name_last=Hurd gender_code=M
location_id=c23328eb-16c7-11ed-9b5f-1234bde3cd05 disambig_city=Montebello disambig_state=CA
disambig_country=US latitude=34.0159398 longitude=-118.111975 county=Los Angeles
state_fips=06 county_fips=037 nr_pt=. _ERROR_=1 _N_=19717504
NOTE: Invalid numeric data, patent_id='D242592' , at line 687 column 9.
patent_id=D242592 inventor_sequence=0 inventor_id=fl:gr_ln:gabourie-1
disambig_inventor_name_first=Gregory S. disambig_inventor_name_last=Gabourie gender_code=M
location_id=7ea6431b-16c8-11ed-9b5f-1234bde3cd05 disambig_city=Ajax disambig_state=ON
disambig_country=CA latitude=43.8505287 longitude=-79.0208814 county=  state_fips=
county_fips=  nr_pt=. _ERROR_=1 _N_=19717505
NOTE: Invalid numeric data, patent_id='D242593' , at line 687 column 9.
patent_id=D242593 inventor_sequence=0 inventor_id=u4klynr9dfu7cj0gyvbq7g5i5
disambig_inventor_name_first=James R. disambig_inventor_name_last=Sterkel gender_code=M
location_id=c2e24e95-16c7-11ed-9b5f-1234bde3cd05 disambig_city=Rancho Santa Fe
disambig_state=CA disambig_country=US latitude=33.0203211 longitude=-117.202813
county=San Diego state_fips=06 county_fips=073 nr_pt=. _ERROR_=1 _N_=19717506
NOTE: Invalid numeric data, patent_id='D242594' , at line 687 column 9.
patent_id=D242594 inventor_sequence=0 inventor_id=fl:wa_ln:monson-1
disambig_inventor_name_first=Wallace A. disambig_inventor_name_last=Monson gender_code=M
location_id=d4add821-16c7-11ed-9b5f-1234bde3cd05 disambig_city=Jackson disambig_state=MN
disambig_country=US latitude=43.6207916 longitude=-94.9886022 county=Jackson state_fips=27
county_fips=063 nr_pt=. _ERROR_=1 _N_=19717507
NOTE: Invalid numeric data, patent_id='D242595' , at line 687 column 9.
patent_id=D242595 inventor_sequence=0 inventor_id=fl:fr_ln:delise-3
disambig_inventor_name_first=Frank C. disambig_inventor_name_last=De Lise gender_code=M
location_id=094f8720-16c8-11ed-9b5f-1234bde3cd05 disambig_city=Nissequogue disambig_state=NY
disambig_country=US latitude=40.9039869 longitude=-73.1978899 county=Suffolk state_fips=36
county_fips=103 nr_pt=. _ERROR_=1 _N_=19717508
NOTE: Invalid numeric data, patent_id='D242595' , at line 687 column 9.
patent_id=D242595 inventor_sequence=1 inventor_id=fl:st_ln:delise-1
disambig_inventor_name_first=Stephen W. disambig_inventor_name_last=De Lise gender_code=M
location_id=07e4f6c2-16c8-11ed-9b5f-1234bde3cd05 disambig_city=West Islip disambig_state=NY
disambig_country=US latitude=40.7058564 longitude=-73.3077301 county=Suffolk state_fips=36
county_fips=103 nr_pt=. _ERROR_=1 _N_=19717509
NOTE: Invalid numeric data, patent_id='D242596' , at line 687 column 9.
patent_id=D242596 inventor_sequence=0 inventor_id=fl:do_ln:munson-1
disambig_inventor_name_first=Donald disambig_inventor_name_last=Munson gender_code=M
location_id=c31f40f3-16c7-11ed-9b5f-1234bde3cd05 disambig_city=Apple Valley disambig_state=CA
disambig_country=US latitude=34.5008311 longitude=-117.1858759 county=San Bernardino
state_fips=06 county_fips=071 nr_pt=. _ERROR_=1 _N_=19717510
NOTE: Invalid numeric data, patent_id='D242597' , at line 687 column 9.
patent_id=D242597 inventor_sequence=0 inventor_id=fl:ab_ln:gamus-1
disambig_inventor_name_first=Abe disambig_inventor_name_last=Gamus gender_code=M
location_id=a8c9fcf3-16c8-11ed-9b5f-1234bde3cd05 disambig_city=Laval disambig_state=QC
disambig_country=CA latitude=45.5757802 longitude=-73.7530656 county=  state_fips=
county_fips=  nr_pt=. _ERROR_=1 _N_=19717511
NOTE: Invalid numeric data, patent_id='D242598' , at line 687 column 9.
patent_id=D242598 inventor_sequence=0 inventor_id=fl:er_ln:kunstlicher-1
disambig_inventor_name_first=Erich disambig_inventor_name_last=Kunstlicher gender_code=M
location_id=  disambig_city=  disambig_state=  disambig_country=  latitude=. longitude=.
county=  state_fips=  county_fips=  nr_pt=. _ERROR_=1 _N_=19717512
NOTE: Invalid numeric data, patent_id='D242599' , at line 687 column 9.
patent_id=D242599 inventor_sequence=0 inventor_id=fl:ja_ln:plummer-4
disambig_inventor_name_first=James E. disambig_inventor_name_last=Plummer gender_code=M
location_id=1ac6f5d6-16c8-11ed-9b5f-1234bde3cd05 disambig_city=Toledo disambig_state=OH
disambig_country=US latitude=41.6529143 longitude=-83.5378173 county=Lucas state_fips=39
county_fips=095 nr_pt=. _ERROR_=1 _N_=19717513
NOTE: Invalid numeric data, patent_id='D242600' , at line 687 column 9.
patent_id=D242600 inventor_sequence=0 inventor_id=fl:th_ln:box-1
disambig_inventor_name_first=Theodor M. disambig_inventor_name_last=Box gender_code=M
location_id=0c4c7aa3-16c8-11ed-9b5f-1234bde3cd05 disambig_city=Brielle disambig_state=NJ
disambig_country=US latitude=40.1078931 longitude=-74.0565263 county=Monmouth state_fips=34
county_fips=025 nr_pt=. _ERROR_=1 _N_=19717514
NOTE: Invalid numeric data, patent_id='D242601' , at line 687 column 9.
WARNING: Limit set by ERRORS= option reached.  Further errors of this type will not be
         printed.
patent_id=D242601 inventor_sequence=0 inventor_id=fl:yo_ln:sato-87
disambig_inventor_name_first=Yo disambig_inventor_name_last=Sato gender_code=M location_id=
disambig_city=  disambig_state=  disambig_country=  latitude=. longitude=. county=
state_fips=  county_fips=  nr_pt=. _ERROR_=1 _N_=19717515
NOTE: Missing values were generated as a result of performing an operation on missing values.
      Each place is given by: (Number of times) at (Line):(Column).
      1479543 at 687:19
NOTE: There were 21197038 observations read from the data set WORK.PATINVLOC.
NOTE: The data set WORK.PATINVLOC1 has 21197038 observations and 16 variables.
NOTE: DATA statement used (Total process time):
      real time           5.47 seconds
      cpu time            4.82 seconds


688!      * 21197038;
689  data pat_kpss_clean;
690  set pat_kpss;
691  grantdate =Input(Put(issue_date, 8.), Yymmdd10.);
692  filedate = Input(Put(filing_date, 8.), Yymmdd10.);
693  format grantdate filedate date9.;
694  drop issue_date filing_date;
695  run;

NOTE: There were 3160453 observations read from the data set WORK.PAT_KPSS.
NOTE: The data set WORK.PAT_KPSS_CLEAN has 3160453 observations and 7 variables.
NOTE: DATA statement used (Total process time):
      real time           0.88 seconds
      cpu time            0.76 seconds


695!      *3160543;
696  proc sql;
696!            * 21197038;
697      create table patinvloc_permno as select distinct
698      a.nr_pt, a.inventor_sequence, a.inventor_id, a.location_id, a.disambig_city as city,
698!  a.disambig_state as state, a.disambig_country as country, a.county, a.state_fips,
698! a.county_fips, a.latitude, a.longitude, b.permno
699      from patinvloc1 as a left join pat_kpss_clean as b
700      on a.nr_pt = b.patent_num having not missing(nr_pt);
NOTE: Table WORK.PATINVLOC_PERMNO created, with 19717495 rows and 13 columns.

701      quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           32.06 seconds
      cpu time            37.06 seconds


702  run; *19717495 (deleted missing nr_pt), 20331127;
703  *isolate patents that are by 1 firm; *we can be sure that the inventor is working for
703! the Compustat assignee;
704  proc sql;
704!            *7849158;
705      create table casg_1firm as select distinct
706      patent_id, assignee_id, disambig_assignee_organization as coname
707      from uspto_patasg1 ;
NOTE: Table WORK.CASG_1FIRM created, with 7843731 rows and 3 columns.

708      quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           4.84 seconds
      cpu time            6.57 seconds


709  run; *7843731 patent with multiple same assignee but different location;
710  PROC SQL;
711      CREATE TABLE casg_1firm1  AS
712      SELECT DISTINCT *, count(patent_id) as num_assignee
713      FROM casg_1firm
714      group BY patent_id;
NOTE: The query requires remerging summary statistics back with the original data.
NOTE: Table WORK.CASG_1FIRM1 created, with 7843731 rows and 4 columns.

715  QUIT;
NOTE: PROCEDURE SQL used (Total process time):
      real time           3.22 seconds
      cpu time            4.70 seconds


715!        * 7843731 ;
716  data casg_1firm2;
717  set casg_1firm1;
718  if num_assignee =1;
719  nr_pt = patent_id +0;
720  if not missing(nr_pt);
721  run;

NOTE: Character values have been converted to numeric values at the places given by:
      (Line):(Column).
      719:9
NOTE: Invalid numeric data, patent_id='ADMINISTRA' , at line 719 column 9.
patent_id=ADMINISTRA assignee_id=fe1dd7c7-16c7-11ed-9b5f-1234bde3cd05 coname=  num_assignee=1
nr_pt=. _ERROR_=1 _N_=7235063
NOTE: Invalid numeric data, patent_id='AGRONOMIQU' , at line 719 column 9.
patent_id=AGRONOMIQU assignee_id=173808ad-16c8-11ed-9b5f-1234bde3cd05 coname=  num_assignee=1
nr_pt=. _ERROR_=1 _N_=7235067
NOTE: Invalid numeric data, patent_id='APPLIANCES' , at line 719 column 9.
patent_id=APPLIANCES assignee_id=67999b0e-49af-11ed-9879-1234bde3cd05 coname=  num_assignee=1
nr_pt=. _ERROR_=1 _N_=7235068
NOTE: Invalid numeric data, patent_id='ARID TROPI' , at line 719 column 9.
patent_id=ARID TROPI assignee_id=37579623-16c8-11ed-9b5f-1234bde3cd05 coname=  num_assignee=1
nr_pt=. _ERROR_=1 _N_=7235073
NOTE: Invalid numeric data, patent_id='Academia C' , at line 719 column 9.
patent_id=Academia C assignee_id=6d731d5e-49af-11ed-9879-1234bde3cd05 coname=  num_assignee=1
nr_pt=. _ERROR_=1 _N_=7235074
NOTE: Invalid numeric data, patent_id='America. I' , at line 719 column 9.
patent_id=America. I assignee_id=c8ea0862-16c7-11ed-9b5f-1234bde3cd05 coname=  num_assignee=1
nr_pt=. _ERROR_=1 _N_=7235077
NOTE: Invalid numeric data, patent_id='BARCELONA' , at line 719 column 9.
patent_id=BARCELONA assignee_id=1d3ee21b-16c8-11ed-9b5f-1234bde3cd05 coname=  num_assignee=1
nr_pt=. _ERROR_=1 _N_=7235078
NOTE: Invalid numeric data, patent_id='BIOLOGICAL' , at line 719 column 9.
patent_id=BIOLOGICAL assignee_id=3b444e27-16c8-11ed-9b5f-1234bde3cd05 coname=  num_assignee=1
nr_pt=. _ERROR_=1 _N_=7235079
NOTE: Invalid numeric data, patent_id='BRANCH"' , at line 719 column 9.
patent_id=BRANCH" assignee_id=13e81279-16c8-11ed-9b5f-1234bde3cd05 coname=  num_assignee=1
nr_pt=. _ERROR_=1 _N_=7235080
NOTE: Invalid numeric data, patent_id='BUILDING P' , at line 719 column 9.
patent_id=BUILDING P assignee_id=0ae5dbad-16c8-11ed-9b5f-1234bde3cd05 coname=  num_assignee=1
nr_pt=. _ERROR_=1 _N_=7235081
NOTE: Invalid numeric data, patent_id='BY GUARANT' , at line 719 column 9.
patent_id=BY GUARANT assignee_id=6aa02d92-16c8-11ed-9b5f-1234bde3cd05 coname=  num_assignee=1
nr_pt=. _ERROR_=1 _N_=7235082
NOTE: Invalid numeric data, patent_id='Biology"' , at line 719 column 9.
patent_id=Biology" assignee_id=8a6e68e9-16c8-11ed-9b5f-1234bde3cd05 coname=  num_assignee=1
nr_pt=. _ERROR_=1 _N_=7235083
NOTE: Invalid numeric data, patent_id='Biotechnol' , at line 719 column 9.
patent_id=Biotechnol assignee_id=843f4caa-49af-11ed-9879-1234bde3cd05 coname=  num_assignee=1
nr_pt=. _ERROR_=1 _N_=7235084
NOTE: Invalid numeric data, patent_id='CENTER"' , at line 719 column 9.
patent_id=CENTER" assignee_id=93778f03-16c8-11ed-9b5f-1234bde3cd05 coname=  num_assignee=1
nr_pt=. _ERROR_=1 _N_=7235085
NOTE: Invalid numeric data, patent_id='COMMERCE C' , at line 719 column 9.
patent_id=COMMERCE C assignee_id=67999b0e-49af-11ed-9879-1234bde3cd05 coname=  num_assignee=1
nr_pt=. _ERROR_=1 _N_=7235102
NOTE: Invalid numeric data, patent_id='COMPANY LI' , at line 719 column 9.
patent_id=COMPANY LI assignee_id=3575c473-16c8-11ed-9b5f-1234bde3cd05 coname=  num_assignee=1
nr_pt=. _ERROR_=1 _N_=7235103
NOTE: Invalid numeric data, patent_id='COMPANY"' , at line 719 column 9.
patent_id=COMPANY" assignee_id=8aac712a-16c8-11ed-9b5f-1234bde3cd05 coname=  num_assignee=1
nr_pt=. _ERROR_=1 _N_=7235104
NOTE: Invalid numeric data, patent_id='Co. Ltd."' , at line 719 column 9.
patent_id=Co. Ltd." assignee_id=3ada708f-16c8-11ed-9b5f-1234bde3cd05 coname=  num_assignee=1
nr_pt=. _ERROR_=1 _N_=7235114
NOTE: Invalid numeric data, patent_id='Commodity' , at line 719 column 9.
patent_id=Commodity assignee_id=3575c473-16c8-11ed-9b5f-1234bde3cd05 coname=  num_assignee=1
nr_pt=. _ERROR_=1 _N_=7235127
NOTE: Invalid numeric data, patent_id='Corporatio' , at line 719 column 9.
WARNING: Limit set by ERRORS= option reached.  Further errors of this type will not be
         printed.
patent_id=Corporatio assignee_id=696f80f0-16c8-11ed-9b5f-1234bde3cd05 coname=  num_assignee=1
nr_pt=. _ERROR_=1 _N_=7235128
NOTE: Missing values were generated as a result of performing an operation on missing values.
      Each place is given by: (Number of times) at (Line):(Column).
      594157 at 719:19
NOTE: There were 7843731 observations read from the data set WORK.CASG_1FIRM1.
NOTE: The data set WORK.CASG_1FIRM2 has 6738255 observations and 5 variables.
NOTE: DATA statement used (Total process time):
      real time           0.86 seconds
      cpu time            0.85 seconds


721!      *6738255;
722  proc sql;
722!            *6738255,  *19717495;
723      create table ppatinvloc_1firm as select distinct
724      a.nr_pt, a.assignee_id, a.coname, b.*
725      from casg_1firm2 as a left join patinvloc_permno as b
726      on a.nr_pt = b.nr_pt;
WARNING: Variable nr_pt already exists on file WORK.PPATINVLOC_1FIRM.
NOTE: Table WORK.PPATINVLOC_1FIRM created, with 17810457 rows and 15 columns.

727      quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           31.49 seconds
      cpu time            24.61 seconds


728  run; * 17810457;
729  data uspto_patapp1a;
730  set uspto_pat;
731  nr_pt = patent_id +0;
732  filedate = input(filing_date, yymmdd10.);
733  format filedate mmddyy10.;
734  run;

NOTE: Character values have been converted to numeric values at the places given by:
      (Line):(Column).
      731:9
NOTE: Invalid argument to function INPUT at line 732 column 12.
application_id=05508062 patent_id=3933359 patent_application_type=05 filing_date=1074-09-23
series_code=05 rule_47_flag=0 nr_pt=3933359 filedate=. _ERROR_=1 _N_=1679687
NOTE: Invalid argument to function INPUT at line 732 column 12.
application_id=05518570 patent_id=3936670 patent_application_type=05 filing_date=1074-10-29
series_code=05 rule_47_flag=0 nr_pt=3936670 filedate=. _ERROR_=1 _N_=1682996
NOTE: Invalid argument to function INPUT at line 732 column 12.
application_id=05563957 patent_id=3937110 patent_application_type=05 filing_date=1075-04-01
series_code=05 rule_47_flag=0 nr_pt=3937110 filedate=. _ERROR_=1 _N_=1683436
NOTE: Invalid argument to function INPUT at line 732 column 12.
application_id=05518254 patent_id=3941467 patent_application_type=05 filing_date=1074-10-29
series_code=05 rule_47_flag=0 nr_pt=3941467 filedate=. _ERROR_=1 _N_=1687793
NOTE: Invalid argument to function INPUT at line 732 column 12.
application_id=05564147 patent_id=3943740 patent_application_type=05 filing_date=1075-04-01
series_code=05 rule_47_flag=0 nr_pt=3943740 filedate=. _ERROR_=1 _N_=1690065
NOTE: Invalid argument to function INPUT at line 732 column 12.
application_id=05497504 patent_id=3963197 patent_application_type=05 filing_date=1074-08-14
series_code=05 rule_47_flag=0 nr_pt=3963197 filedate=. _ERROR_=1 _N_=1709512
NOTE: Invalid argument to function INPUT at line 732 column 12.
application_id=05571931 patent_id=3967129 patent_application_type=05 filing_date=1075-04-28
series_code=05 rule_47_flag=0 nr_pt=3967129 filedate=. _ERROR_=1 _N_=1713440
NOTE: Invalid argument to function INPUT at line 732 column 12.
application_id=05555245 patent_id=4003574 patent_application_type=05 filing_date=1075-03-04
series_code=05 rule_47_flag=0 nr_pt=4003574 filedate=. _ERROR_=1 _N_=1749849
NOTE: Invalid argument to function INPUT at line 732 column 12.
application_id=05663038 patent_id=4049770 patent_application_type=05 filing_date=1076-03-02
series_code=05 rule_47_flag=0 nr_pt=4049770 filedate=. _ERROR_=1 _N_=1795986
NOTE: Invalid argument to function INPUT at line 732 column 12.
application_id=05629532 patent_id=4078170 patent_application_type=05 filing_date=0975-11-06
series_code=05 rule_47_flag=0 nr_pt=4078170 filedate=. _ERROR_=1 _N_=1824354
NOTE: Invalid argument to function INPUT at line 732 column 12.
application_id=05865602 patent_id=4143614 patent_application_type=05 filing_date=1077-12-29
series_code=05 rule_47_flag=0 nr_pt=4143614 filedate=. _ERROR_=1 _N_=1889742
NOTE: Invalid argument to function INPUT at line 732 column 12.
application_id=05930462 patent_id=4187870 patent_application_type=05 filing_date=1078-08-03
series_code=05 rule_47_flag=0 nr_pt=4187870 filedate=. _ERROR_=1 _N_=1933936
NOTE: Invalid argument to function INPUT at line 732 column 12.
application_id=05945628 patent_id=4204772 patent_application_type=05 filing_date=1078-09-25
series_code=05 rule_47_flag=0 nr_pt=4204772 filedate=. _ERROR_=1 _N_=1950812
NOTE: Invalid argument to function INPUT at line 732 column 12.
application_id=06358510 patent_id=4379065 patent_application_type=06 filing_date=1082-03-15
series_code=06 rule_47_flag=0 nr_pt=4379065 filedate=. _ERROR_=1 _N_=2124869
NOTE: Invalid argument to function INPUT at line 732 column 12.
application_id=06392043 patent_id=4423140 patent_application_type=06 filing_date=1298-06-25
series_code=06 rule_47_flag=0 nr_pt=4423140 filedate=. _ERROR_=1 _N_=2168881
NOTE: Invalid argument to function INPUT at line 732 column 12.
application_id=06820427 patent_id=4689471 patent_application_type=06 filing_date=1096-01-18
series_code=06 rule_47_flag=0 nr_pt=4689471 filedate=. _ERROR_=1 _N_=2434888
NOTE: Invalid numeric data, patent_id='D242583' , at line 731 column 9.
application_id=05579154 patent_id=D242583 patent_application_type=05 filing_date=1975-05-20
series_code=05 rule_47_flag=0 nr_pt=. filedate=05/20/1975 _ERROR_=1 _N_=7715527
NOTE: Invalid numeric data, patent_id='D242584' , at line 731 column 9.
application_id=05594306 patent_id=D242584 patent_application_type=05 filing_date=1975-07-09
series_code=05 rule_47_flag=0 nr_pt=. filedate=07/09/1975 _ERROR_=1 _N_=7715528
NOTE: Invalid numeric data, patent_id='D242585' , at line 731 column 9.
application_id=05594307 patent_id=D242585 patent_application_type=05 filing_date=1975-07-09
series_code=05 rule_47_flag=0 nr_pt=. filedate=07/09/1975 _ERROR_=1 _N_=7715529
NOTE: Invalid numeric data, patent_id='D242586' , at line 731 column 9.
WARNING: Limit set by ERRORS= option reached.  Further errors of this type will not be
         printed.
application_id=05594308 patent_id=D242586 patent_application_type=05 filing_date=1975-07-09
series_code=05 rule_47_flag=0 nr_pt=. filedate=07/09/1975 _ERROR_=1 _N_=7715530
NOTE: Missing values were generated as a result of performing an operation on missing values.
      Each place is given by: (Number of times) at (Line):(Column).
      799679 at 731:19
NOTE: Mathematical operations could not be performed at the following places. The results of
      the operations have been set to missing values.
      Each place is given by: (Number of times) at (Line):(Column).
      16 at 732:12
NOTE: There were 8515205 observations read from the data set WORK.USPTO_PAT.
NOTE: The data set WORK.USPTO_PATAPP1A has 8515205 observations and 8 variables.
NOTE: DATA statement used (Total process time):
      real time           1.14 seconds
      cpu time            1.04 seconds


735  proc sql;
735!           * 17810457;
736      create table ppatinvloc_1firm1 as select distinct
737      a.*, b.filedate
738      from ppatinvloc_1firm as a left join uspto_patapp1a as b
739      on a.nr_pt = b.nr_pt;
NOTE: Table WORK.PPATINVLOC_1FIRM1 created, with 17810457 rows and 16 columns.

740      quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           29.65 seconds
      cpu time            23.59 seconds


741  run; * 17810457;
742  data ppatinvloc_1firm1a;
743  set ppatinvloc_1firm1;
744  cfips = state_fips*1000+county_fips;
745  if not missing(cfips);
746  run;

NOTE: Character values have been converted to numeric values at the places given by:
      (Line):(Column).
      744:9    744:25
NOTE: Missing values were generated as a result of performing an operation on missing values.
      Each place is given by: (Number of times) at (Line):(Column).
      9210992 at 744:19   9 at 744:24
NOTE: There were 17810457 observations read from the data set WORK.PPATINVLOC_1FIRM1.
NOTE: The data set WORK.PPATINVLOC_1FIRM1A has 8599456 observations and 17 variables.
NOTE: DATA statement used (Total process time):
      real time           3.23 seconds
      cpu time            2.62 seconds


746!      *8599456;
747      PROC EXPORT DATA= ppatinvloc_1firm1a
748      OUTFILE= "C:\Users\shaphanng\Dropbox\TaxSubsidy\replication\stata working
748! files\inventor_mvt_full.dta"
749      DBMS=STATA REPLACE;
750      RUN;

NOTE: The export data set has 8599456 observations and 17 variables.
NOTE: "C:\Users\shaphanng\Dropbox\TaxSubsidy\replication\stata working
      files\inventor_mvt_full.dta" file was successfully created.
NOTE: PROCEDURE EXPORT used (Total process time):
      real time           6.38 seconds
      cpu time            4.42 seconds


751  proc sql;
751!            *3160543;
752      create table cpatinvloc as select distinct
753      a.patent_num as nr_pt, a.*, b.inventor_sequence, b.inventor_id, b.location_id,
753! b.disambig_city as city, b.disambig_state as state, b.disambig_country as country,
753! b.county, b.state_fips, b.county_fips, b.latitude, b.longitude
754      from pat_kpss_clean as a left join patinvloc1 as b
755      on a.patent_num = b.nr_pt;
NOTE: Table WORK.CPATINVLOC created, with 7717765 rows and 19 columns.

756      quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           18.02 seconds
      cpu time            21.84 seconds


757  run; * 7717765;
758  *isolate patents that are by 1 firm; *we can be sure that the inventor is working for
758! the Compustat assignee;
759  proc sql;
759!            *7849158;
760      create table casg_1firm as select distinct
761      patent_id, assignee_id
762      from uspto_patasg1 ;
NOTE: Table WORK.CASG_1FIRM created, with 7843731 rows and 2 columns.

763      quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           3.90 seconds
      cpu time            4.89 seconds


764  run; *7843731 patent with multiple same assignee but different location;
765  PROC SQL;
766      CREATE TABLE casg_1firm1  AS
767      SELECT DISTINCT *, count(patent_id) as num_assignee
768      FROM casg_1firm
769      group BY patent_id;
NOTE: The query requires remerging summary statistics back with the original data.
NOTE: Table WORK.CASG_1FIRM1 created, with 7843731 rows and 3 columns.

770  QUIT;
NOTE: PROCEDURE SQL used (Total process time):
      real time           1.98 seconds
      cpu time            3.01 seconds


770!        * 7843731 ;
771  data casg_1firm2;
772  set casg_1firm1;
773  if num_assignee =1;
774  nr_pt = patent_id +0;
775  if not missing(nr_pt);
776  run;

NOTE: Character values have been converted to numeric values at the places given by:
      (Line):(Column).
      774:9
NOTE: Invalid numeric data, patent_id='ADMINISTRA' , at line 774 column 9.
patent_id=ADMINISTRA assignee_id=fe1dd7c7-16c7-11ed-9b5f-1234bde3cd05 num_assignee=1 nr_pt=.
_ERROR_=1 _N_=7235063
NOTE: Invalid numeric data, patent_id='AGRONOMIQU' , at line 774 column 9.
patent_id=AGRONOMIQU assignee_id=173808ad-16c8-11ed-9b5f-1234bde3cd05 num_assignee=1 nr_pt=.
_ERROR_=1 _N_=7235067
NOTE: Invalid numeric data, patent_id='APPLIANCES' , at line 774 column 9.
patent_id=APPLIANCES assignee_id=67999b0e-49af-11ed-9879-1234bde3cd05 num_assignee=1 nr_pt=.
_ERROR_=1 _N_=7235068
NOTE: Invalid numeric data, patent_id='ARID TROPI' , at line 774 column 9.
patent_id=ARID TROPI assignee_id=37579623-16c8-11ed-9b5f-1234bde3cd05 num_assignee=1 nr_pt=.
_ERROR_=1 _N_=7235073
NOTE: Invalid numeric data, patent_id='Academia C' , at line 774 column 9.
patent_id=Academia C assignee_id=6d731d5e-49af-11ed-9879-1234bde3cd05 num_assignee=1 nr_pt=.
_ERROR_=1 _N_=7235074
NOTE: Invalid numeric data, patent_id='America. I' , at line 774 column 9.
patent_id=America. I assignee_id=c8ea0862-16c7-11ed-9b5f-1234bde3cd05 num_assignee=1 nr_pt=.
_ERROR_=1 _N_=7235077
NOTE: Invalid numeric data, patent_id='BARCELONA' , at line 774 column 9.
patent_id=BARCELONA assignee_id=1d3ee21b-16c8-11ed-9b5f-1234bde3cd05 num_assignee=1 nr_pt=.
_ERROR_=1 _N_=7235078
NOTE: Invalid numeric data, patent_id='BIOLOGICAL' , at line 774 column 9.
patent_id=BIOLOGICAL assignee_id=3b444e27-16c8-11ed-9b5f-1234bde3cd05 num_assignee=1 nr_pt=.
_ERROR_=1 _N_=7235079
NOTE: Invalid numeric data, patent_id='BRANCH"' , at line 774 column 9.
patent_id=BRANCH" assignee_id=13e81279-16c8-11ed-9b5f-1234bde3cd05 num_assignee=1 nr_pt=.
_ERROR_=1 _N_=7235080
NOTE: Invalid numeric data, patent_id='BUILDING P' , at line 774 column 9.
patent_id=BUILDING P assignee_id=0ae5dbad-16c8-11ed-9b5f-1234bde3cd05 num_assignee=1 nr_pt=.
_ERROR_=1 _N_=7235081
NOTE: Invalid numeric data, patent_id='BY GUARANT' , at line 774 column 9.
patent_id=BY GUARANT assignee_id=6aa02d92-16c8-11ed-9b5f-1234bde3cd05 num_assignee=1 nr_pt=.
_ERROR_=1 _N_=7235082
NOTE: Invalid numeric data, patent_id='Biology"' , at line 774 column 9.
patent_id=Biology" assignee_id=8a6e68e9-16c8-11ed-9b5f-1234bde3cd05 num_assignee=1 nr_pt=.
_ERROR_=1 _N_=7235083
NOTE: Invalid numeric data, patent_id='Biotechnol' , at line 774 column 9.
patent_id=Biotechnol assignee_id=843f4caa-49af-11ed-9879-1234bde3cd05 num_assignee=1 nr_pt=.
_ERROR_=1 _N_=7235084
NOTE: Invalid numeric data, patent_id='CENTER"' , at line 774 column 9.
patent_id=CENTER" assignee_id=93778f03-16c8-11ed-9b5f-1234bde3cd05 num_assignee=1 nr_pt=.
_ERROR_=1 _N_=7235085
NOTE: Invalid numeric data, patent_id='COMMERCE C' , at line 774 column 9.
patent_id=COMMERCE C assignee_id=67999b0e-49af-11ed-9879-1234bde3cd05 num_assignee=1 nr_pt=.
_ERROR_=1 _N_=7235102
NOTE: Invalid numeric data, patent_id='COMPANY LI' , at line 774 column 9.
patent_id=COMPANY LI assignee_id=3575c473-16c8-11ed-9b5f-1234bde3cd05 num_assignee=1 nr_pt=.
_ERROR_=1 _N_=7235103
NOTE: Invalid numeric data, patent_id='COMPANY"' , at line 774 column 9.
patent_id=COMPANY" assignee_id=8aac712a-16c8-11ed-9b5f-1234bde3cd05 num_assignee=1 nr_pt=.
_ERROR_=1 _N_=7235104
NOTE: Invalid numeric data, patent_id='Co. Ltd."' , at line 774 column 9.
patent_id=Co. Ltd." assignee_id=3ada708f-16c8-11ed-9b5f-1234bde3cd05 num_assignee=1 nr_pt=.
_ERROR_=1 _N_=7235114
NOTE: Invalid numeric data, patent_id='Commodity' , at line 774 column 9.
patent_id=Commodity assignee_id=3575c473-16c8-11ed-9b5f-1234bde3cd05 num_assignee=1 nr_pt=.
_ERROR_=1 _N_=7235127
NOTE: Invalid numeric data, patent_id='Corporatio' , at line 774 column 9.
WARNING: Limit set by ERRORS= option reached.  Further errors of this type will not be
         printed.
patent_id=Corporatio assignee_id=696f80f0-16c8-11ed-9b5f-1234bde3cd05 num_assignee=1 nr_pt=.
_ERROR_=1 _N_=7235128
NOTE: Missing values were generated as a result of performing an operation on missing values.
      Each place is given by: (Number of times) at (Line):(Column).
      594157 at 774:19
NOTE: There were 7843731 observations read from the data set WORK.CASG_1FIRM1.
NOTE: The data set WORK.CASG_1FIRM2 has 6738255 observations and 4 variables.
NOTE: DATA statement used (Total process time):
      real time           0.67 seconds
      cpu time            0.65 seconds


776!      *6738255;
777  **merge with cpatinvloc;
778  proc sql;
778!            *6738255;
779      create table cpatinvloc_1firm as select distinct
780      a.nr_pt, b.*
781      from casg_1firm2 as a left join cpatinvloc as b
782      on a.nr_pt = b.nr_pt;
WARNING: Variable nr_pt already exists on file WORK.CPATINVLOC_1FIRM.
NOTE: Table WORK.CPATINVLOC_1FIRM created, with 11134834 rows and 19 columns.

783      quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           10.55 seconds
      cpu time            15.73 seconds


784  run; * 11134834;
785  data cpatinvloc_1firm1;
786  set cpatinvloc_1firm ;
787  if not missing(permno);
788  drop patent_num;
789  run;

NOTE: There were 11134834 observations read from the data set WORK.CPATINVLOC_1FIRM.
NOTE: The data set WORK.CPATINVLOC_1FIRM1 has 6889809 observations and 18 variables.
NOTE: DATA statement used (Total process time):
      real time           1.69 seconds
      cpu time            1.40 seconds


789!      * 6889809;
790  proc sql;
790!            * 6889809;
791      create table invmvt as select distinct
792      a.*, b.gvkey, b.datadate, b.fyear
793      from cpatinvloc_1firm1 as a left join sas.ccinvfnm_ext as b
794      on a.nr_pt = b.nr_pt and a.permno = b.permno;
NOTE: Table WORK.INVMVT created, with 6889826 rows and 21 columns.

795      quit;
NOTE: PROCEDURE SQL used (Total process time):
      real time           24.03 seconds
      cpu time            19.59 seconds


796  run; * 6889826;
797  data invmvt1;
798  set invmvt;
799  if not missing(gvkey);
800  cfips = state_fips*1000+county_fips;
801  run;

NOTE: Character values have been converted to numeric values at the places given by:
      (Line):(Column).
      800:9    800:25
NOTE: Missing values were generated as a result of performing an operation on missing values.
      Each place is given by: (Number of times) at (Line):(Column).
      258669 at 800:19
NOTE: There were 6889826 observations read from the data set WORK.INVMVT.
NOTE: The data set WORK.INVMVT1 has 4183316 observations and 22 variables.
NOTE: DATA statement used (Total process time):
      real time           1.41 seconds
      cpu time            0.96 seconds


801!      * 4183316;
802  **export to stata;
803  PROC EXPORT DATA= invmvt1
804      OUTFILE= "C:\Users\shaphanng\Dropbox\TaxSubsidy\replication\stata working
804! files\inventor_mvt.dta"
805      DBMS=STATA REPLACE;
806      RUN;

NOTE: The export data set has 4183316 observations and 22 variables.
NOTE: "C:\Users\shaphanng\Dropbox\TaxSubsidy\replication\stata working
      files\inventor_mvt.dta" file was successfully created.
NOTE: PROCEDURE EXPORT used (Total process time):
      real time           1.99 seconds
      cpu time            1.95 seconds
